#include "StdAfx.h"
#include "SplashScreen.h"


void SplashScreen::show(sf::RenderWindow& window)
{
	sf::Texture texture;
	if(!texture.loadFromFile("Assets/Images/quartoSplashScreen.png")) return;
	sf::Sprite sprite(texture);

	sf::Texture logoTexture;	
	if(!logoTexture.loadFromFile("Assets/Images/quarto.png")) return;
	sf::Sprite logoSprite(logoTexture);
	logoSprite.setPosition(212,0);

	sf::Texture flashyTexture;	
	if(!flashyTexture.loadFromFile("Assets/Images/flashyText.png")) return;
	sf::Sprite flashySprite(flashyTexture);
	flashySprite.setPosition(256,556);

	sf::Event event;
	while(true)
	{
		window.clear(sf::Color(0,0,0));
		window.draw(sprite);
		window.draw(logoSprite);
		window.draw(flashySprite);
		window.display();
		while(window.pollEvent(event))
		{
			if(event.type == sf::Event::EventType::KeyPressed 
				|| event.type == sf::Event::EventType::MouseButtonPressed 
				|| event.type == sf::Event::EventType::Closed) return;
		}
		if(flashySprite.getScale().x == 0) flashySprite.setScale(1,1);
		else flashySprite.setScale(0,0);
		sf::Time time = sf::milliseconds(250);
		sf::sleep(time);
	}
}
